Plot of movie ratings against budget to see if there is any linear relationship

success(syko2021gmail.com)

2024-09-05

Overview

In this slide I demonstrate that movies with better ratings do not generally have higher budgets

Libraries and Dataset

Here are the libraries and dataset I used

library(ggplot2movies)
library(ggplot2)
library(dplyr)
library(plotly)

data("movies")
names(movies)
##  [1] "title"       "year"        "length"      "budget"      "rating"     
##  [6] "votes"       "r1"          "r2"          "r3"          "r4"         
## [11] "r5"          "r6"          "r7"          "r8"          "r9"         
## [16] "r10"         "mpaa"        "Action"      "Animation"   "Comedy"     
## [21] "Drama"       "Documentary" "Romance"     "Short"

Data cleaning

movies = filter(movies, !is.na(budget) & !is.na(rating))

Plot

Here I make a scatter plot of movie ratings against budget and added a fitted model. The line is exactly horizontal, which suggest that there is no relationship, at least without further analysis.

## `geom_smooth()` using formula = 'y ~ x'

The code I used for the plot

g = ggplot(movies, aes(rating,budget)) +
  geom_point() + geom_smooth(method='lm')

ggplotly(g)